
import 'package:flutter/material.dart';

/**
 * floatingActionButtonLocation的值接收FloatingActionButtonLocation类型，而它是一个抽象类，
 * 所以实现一个自定义类，并重写getOffset方法即可：
 */
class CustomFloatingActionButtonLocation extends FloatingActionButtonLocation {
  // 默认位置
  FloatingActionButtonLocation location;
  double offsetX;    // X方向的偏移量
  double offsetY;    // Y方向的偏移量
  CustomFloatingActionButtonLocation(this.location, this.offsetX, this.offsetY);

  @override
  Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry) {
    Offset offset = location.getOffset(scaffoldGeometry);
    return Offset(offset.dx + offsetX, offset.dy + offsetY);
  }
}